//
// Created by xili on 2024/8/3 16:16.
// Go big or go home.
//
#include <iostream>
#include <unordered_map>

using namespace std;

class Solution {
public:
    bool digitCount(string num) {
        unordered_map<int, int> ump;
        for (auto &item: num) {
            ump[item - '0']++;
        }
        for (int i = 0; i < num.size(); i++) {
            if ((num[i] - '0') != ump[i]) {
                return false;
            }
        }
        return true;
    }
};